{% extends "api.html" %}
{% block api_content %}
<p>BossSession is a multiadapter session management. The following adapters are supported (specified in boss.config):</p>
<ul>
    <li><code>cache</code> - Store sessions in whatever cache system is configured. Requires <code>cache_enable</code> to be set to <code>true</code>
    <li><code>mnesia</code> - Mnesia. Requires the node to have a name.</li>
    <li><code>mock</code> - In-memory sessions which uses ETS.</li>
</ul>

<p>BossSession is automatically started, so, by default an ETS based session support is provided.</p>

<p>The current session ID is available to controllers as the second module parameter. To disable sessions, set "session_enable" to "false" in your boss.config file.</p>

<p>BossFlash is a utility on top of boss_session, you can store messages between requests, automatically populated to the view as <code>{{ "{{ boss_flash }}" }}</code> and deleted from session after used.</p>

<h2>boss_session</h2>

{% for function in session_functions %}
    {% if function.description_long %}
        <div class="example {% cycle 'row1' 'row2' %}">
          <div class="code">
                {{ function.function }}{% if function.typespec %}{{ function.typespec }}{% endif %}
            </div>
            <p>{{ function.description_long }}</p>
        </div>
    {% endif %}
{% endfor %}


<h2>boss_flash</h2>

<p>Add flash messages in the controller like:</p>

<div class="code">
boss_flash:add(SessionID, notice, "Flash Title", "Flash Message")
</div>

<p>Use the boss_flash var in the view, should render "notice - Flash Title - Flash Message":</p>
<div class="code">
{{ "{% for flash in boss_flash %}" }}
{{ "{{ flash.method }} - {{ flash.title }} - {{ flash.message }}" }}
{{ "{% endfor %}" }}
</div>

<h2>Functions</h2>

{% for function in flash_functions %}
    {% if function.description_long %}
        <div class="example {% cycle 'row1' 'row2' %}">
          <div class="code">
                {{ function.function }}{% if function.typespec %}{{ function.typespec }}{% endif %}
            </div>
            <p>{{ function.description_long }}</p>
        </div>
    {% endif %}
{% endfor %}

{% endblock %}
